// $codepro.audit.disable assignmentToNonFinalStatic
package OfficeServer.report;

import java.io.Serializable;

/**
 * This is the Lab Work class that contains all the information regarding a Lab
 * work. All Lab works will be a child of Treatment.
 * 
 * @author So-mi
 */

public class LabWork extends Treatment implements Serializable {
    /**
     * 
     */
    private static final long serialVersionUID = 1L;

    private String doctor;

    private String patient;

    private int dueDate;

    private String instructions;

    private double cost;

    private String nurse;

    private String type;

    private int treatmentID;

    /**
     * Creates Lab work
     * 
     * @param doctor
     *            String representing the name of the doctor who issued the Lab
     *            work
     * @param patient
     *            String representing the name of the patient that needs to have
     *            a Lab work done
     * @param dueDate
     *            int representing the day which the lab work should be done by
     * @param instructions
     *            String Additional information (e.g. follow up instructions)
     *            from the doctor regarding the lab work
     * @param cost
     *            Double representing the cost of the treatment
     * @param nurse
     *            String representing the name of the nurse that performs the
     *            lab work
     * @param type
     *            String representing what type of lab work it is (e.g. blood
     *            tests, urine tests, immunizations)
     */
    public LabWork(String doctor, String patient, int dueDate,
	    String instructions, double cost, String nurse, String type) {
	this.doctor = doctor;
	this.patient = patient;
	this.dueDate = dueDate;
	this.instructions = instructions;
	this.cost = cost;
	this.nurse = nurse;
	this.type = type;
	treatmentID = super.tCount;
	super.tCount++;
    }

    /**
     * gets the name of the Doctor
     * 
     * @return doctor
     */
    public String getDoctor() {
	return doctor;
    }

    /**
     * sets the name of the doctor
     * 
     * @param doctor
     */
    public void setDoctor(String doctor) {
	this.doctor = doctor;
    }

    /**
     * gets the name of the patient
     * 
     * @return patient
     */
    public String getPatient() {
	return patient;
    }

    /**
     * sets the name of the patient
     * 
     * @param patient
     */
    public void setPatient(String patient) {
	this.patient = patient;
    }

    /**
     * gets the date which the labwork should be done by
     * 
     * @return dueDate
     */
    public int getDueDate() {
	return dueDate;
    }

    /**
     * sets the due date
     * 
     * @param dueDate
     */
    public void setDueDate(int dueDate) {
	this.dueDate = dueDate;
    }

    /**
     * gets the instructions written by the doctor
     * 
     * @return instructions
     */
    public String getInstructions() {
	return instructions;
    }

    /**
     * sets the instructinos
     * 
     * @param instructions
     */
    public void setInstructions(String instructions) {
	this.instructions = instructions;
    }

    /**
     * gets the cost of the Lab work
     * 
     * @return cost
     */
    public double getCost() {
	return cost;
    }

    /**
     * sets the cost of the labwork
     * 
     * @param cost
     */
    public void setCost(double cost) {
	this.cost = cost;
    }

    /**
     * gets the nurse doing the labwork
     * 
     * @return nurse
     */
    public String getNurse() {
	return nurse;
    }

    /**
     * sets the nurse doing the lab work
     * 
     * @param nurse
     */
    public void setNurse(String nurse) {
	this.nurse = nurse;
    }

    /**
     * gets the type of lab work done
     * 
     * @return type
     */
    public String getType() {
	return type;
    }

    /**
     * sets the type of lab work done
     * 
     * @param type
     */
    public void setType(String type) {
	this.type = type;
    }

    /**
     * Updates the lab work It will check (for Strings) if there is a field in
     * LabWork update that is filled out. If not, it'll use the current lab
     * work's information. If it is, it will set the current lab work's
     * information to update's information.
     * 
     * @param update
     *            LabWork object with the newest information
     */
    public void updateLabWork(LabWork update) {
	if (update != null) {
	    this.doctor = (update.getDoctor() == null) ? this.doctor
		    : new String(update.getDoctor());
	    this.patient = (update.getPatient() == null) ? this.patient
		    : new String(update.getPatient());
	    this.dueDate = update.getDueDate();
	    this.instructions = (update.getInstructions() == null) ? this.instructions
		    : new String(update.getInstructions());
	    this.cost = update.getCost();
	    this.nurse = (update.getNurse() == null) ? this.nurse : new String(
		    update.getNurse());
	    this.type = (update.getType() == null) ? this.type : new String(
		    update.getType());
	}
    }

    /*
     * (non-Javadoc)
     * 
     * @see report.Treatment#getTID()
     */
    @Override
    public int getTID() {
	return treatmentID;
    }
}
